package com.suray.type;

/**
 * 6代车当前定位状态
 */
public enum SeerRobotPositionStatus {
    INVALID(-1, "无效"),
    FAILED(0, "定位失败"),
    SUCCESS(1, "定位正确"),
    RELOCING(2, "正在重定位"),
    COMPLETED(3, "定位完成, \"请点击确认定位\""),
    ;

    int value;
    String des;
    SeerRobotPositionStatus(int value, String des) {
        this.value = value;
        this.des = des;
    }

    public static SeerRobotPositionStatus parseStatus(Integer value) {
        if (value == null) {
            return INVALID;
        }

        for (SeerRobotPositionStatus seerRobotPositionStatus : SeerRobotPositionStatus.values()) {
            if (seerRobotPositionStatus.value == value) {
                return seerRobotPositionStatus;
            }
        }

        return INVALID;
    }

    public int getValue() {
        return value;
    }

    @Override
    public String toString() {
        return des;
    }
}
